package com.example.e

import android.app.Activity
import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.e.Adapter.ShouhuoAddressAdapter
import com.example.e.data.ShouhuoAddress
import kotlinx.android.synthetic.main.activity_add_address.*
import kotlinx.android.synthetic.main.activity_location.*
import kotlinx.android.synthetic.main.activity_search_result.*
import java.io.*
import java.lang.StringBuilder

class AddAddressActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_add_address)

        save_shouhuo.setOnClickListener(){
            val intent = Intent()

            val shouhuo_name = txt_shouhuo_name.text.toString()
            val shouhuo_number = txt_shouhuo_number.text.toString()
            val shouhuo_address = txt_shouhuo_address.text.toString()
            if (shouhuo_name == null || shouhuo_number == null || shouhuo_address == null) {
                Toast.makeText(this, "请输入", Toast.LENGTH_LONG).show()
            }
            else {
                intent.putExtra("shouhuo_name", shouhuo_name)
                intent.putExtra("shouhuo_number", shouhuo_number)
                intent.putExtra("shouhuo_address", shouhuo_address)
                setResult(Activity.RESULT_OK, intent)  //确认码
                finish()  //关闭窗体
            }
        }
        backLocation.setOnClickListener(){
            finish()
        }
    }

}